﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminMTP.Master" AutoEventWireup="true" CodeBehind="NewsManager.aspx.cs" Inherits="SQT.tracnghiem.Admin.NewsManager" %>

<%@ Import Namespace="DataAccess" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../Scripts/tinymce/tinymce.min.js"></script>
    <script src="../Scripts/tinymce/plugins/furigana/plugin.min.js"></script>
    <style>
        .mce-tinymce {
            float: right !important;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <%
        if (int.Parse(Session["admin_level"].ToString()) != 5 && int.Parse(Session["admin_level"].ToString()) != 1)
        {
    %>
    <script type="text/javascript">
        window.location = "../../AccessDeny.html";
    </script>
    <%
        }
        var get_cate = (from p in new TblNewsCategoryController().FetchAll().Where(x => x.CatDelete == false) orderby p.CatIndex ascending select p);
    %>
    <div id="main-admin" class="admin-df w3-row w3-light-grey">
        <header class="w3-padding w3-large w3-center w3-teal">BÀI VIẾT</header>
        <div class="w3-row" style="padding: 5px">
            <div class="w3-third w3-padding w3-border-right w3-border-teal">
                <div class="w3-row w3-margin-bottom">
                    <select id="danhmuc" class="news-ad-select w3-teal">
                        <option value="0" selected="selected">Chọn danh mục</option>
                        <% foreach (TblNewsCategory cat in get_cate)
                           { %>
                        <option value="<%=cat.CatId %>"><%=cat.CatName %></option>
                        <%} %>
                    </select>
                    <a id="btn_Edit_Category" onclick="suadanhmuc()" class="w3-btn w3-teal" style="margin-bottom: 3px; display: none" title="Chỉnh sửa danh mục"><i class="fa fa-cogs"></i></a>
                    <a id="btn_Range_Category" onclick="sapxepdanhmuc()" class="w3-btn w3-teal" style="margin-bottom: 3px" title="Sắp xếp danh mục"><i class="fa fa-recycle"></i></a>
                    <a id="btn_Add_Category" onclick="themdanhmuc()" class="w3-btn w3-teal" style="margin-bottom: 3px" title="Thêm danh mục"><i class="fa fa-plus"></i></a>
                </div>
                <div class="w3-row">
                    <div id="news_area" class="w3-row" style="display: none">
                    </div>
                    <div id="Add_News" class="w3-padding w3-center" style="display: none">
                        <a id="btn_add_news" class="w3-btn w3-teal" title="Thêm bài viết"><i class="fa fa-plus"></i>&nbsp;Thêm bài viết</a>
                    </div>
                </div>
            </div>
            <div id="news_detail_area" class="w3-twothird" style="display: none">
            </div>
        </div>
    </div>
    <div id="sapxepdanhmuc" class="w3-modal">
        <div class="w3-modal-content w3-animate-top w3-card-8 w3-teal" style="width: 30%">
                <header class="news-header w3-teal"><i class="fa fa-bars"></i>&nbsp;SẮP XẾP DANH MỤC<i class="fa fa-times w3-right w3-closebtn" onclick="$('#sapxepdanhmuc').fadeOut()"></i></header>
                <ul id="sortable" class="news-menu w3-ul w3-white">
                    <%foreach (TblNewsCategory sort in get_cate){ %>
                    <li class="ui-state-default"><a class="w3-hide cate_id"><%=sort.CatId %></a><a href="javascript:;" class="news-menu-item hvr-underline-reveal"><%=sort.CatName %></a></li>
                    <%} %>
                </ul>
            <div class="w3-padding w3-center"><a onclick="sort_cate()" class="w3-btn w3-teal w3-border"><i class="fa fa-save"></i>&nbsp;Lưu</a></div>
        </div>
    </div>
    <div id="themdanhmuc" class="w3-modal">
        <div class="w3-modal-content w3-animate-top w3-card-8 w3-teal" style="width: 30%">
            <header class="w3-padding w3-center">
                <span onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-closebtn">&times;</span>
                <p class="w3-xlarge">Thêm mới danh mục</p>
            </header>
            <div class="w3-padding w3-row">
                <input type="text" id="txt_new_category" required="required" placeholder="Tên danh mục" autofocus="autofocus" style="width: 100%; padding: 0.5%; color: black" />
            </div>
            <div class="w3-row w3-padding w3-center">
                <a id="btn_new_category" class="w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-save"></i>&nbsp;Lưu</a>
            </div>
        </div>
    </div>
    <div id="suadanhmuc" class="w3-modal">
        <div class="w3-modal-content w3-animate-top w3-card-8 w3-teal" style="width: 30%">
            <header class="w3-padding w3-center">
                <span onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-closebtn">&times;</span>
                <p class="w3-xlarge">Sửa danh mục</p>
            </header>
            <div class="w3-padding w3-row">
                <input type="text" id="txt_edit_category" required="required" placeholder="Tên danh mục" autofocus="autofocus" style="width: 100%; padding: 0.5%; color: black" />
            </div>
            <div class="w3-row w3-padding w3-center">
                <a id="btn_edit_category" class="w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-save"></i>&nbsp;Lưu</a>
                <a onclick="xoadanhmuc();" class="w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-trash"></i>&nbsp;Xóa</a>
            </div>
        </div>
    </div>
    <div id="xoadanhmuc" class="w3-modal">
        <div class="w3-modal-content w3-animate-top w3-card-8 w3-teal" style="width: 45%">
            <header class="w3-padding w3-center">
                <div id="txt_del_cate_id" class="w3-hide"></div>
                <span onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-closebtn">&times;</span>
                <p class="w3-xlarge">Bạn có chắc chắn muốn xóa danh mục này ?</p>
            </header>
            <div class="w3-row w3-padding w3-center">
                <a class="w3-btn btn_del_category w3-teal w3-border w3-border-white"><i class="fa fa-trash"></i>&nbsp;Xóa</a>
                <a onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-times"></i>&nbsp;Hủy</a>
            </div>
        </div>
    </div>
    <div id="success-modal" class="w3-row w3-animate-right" style="position: fixed; right: 25px; bottom: 20%; display: none">
        <div class="w3-teal w3-card-4 w3-center" style="padding: 20px; opacity: 0.9">
            <header class="w3-large"><span class="success_content"></span>&nbsp;<i class="fa fa-check"></i></header>
        </div>
    </div>
    <div id="error-modal" class="w3-row w3-animate-right" style="position: fixed; right: 25px; bottom: 20%; display: none">
        <div class="w3-red w3-card-4 w3-center" style="padding: 20px; opacity: 0.9">
            <header class="w3-large"><span class="error_content"></span>&nbsp;<i class="fa fa-times"></i></header>
        </div>
    </div>
    <div id="xoabaiviet" class="w3-modal">
        <div class="w3-modal-content w3-animate-top w3-card-8 w3-teal" style="width: 45%">
            <header class="w3-padding w3-center">
                <span onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-closebtn">&times;</span>
                <p class="w3-xlarge">Bạn có chắc chắn muốn xóa bài viết này ?</p>
            </header>
            <div class="w3-row w3-padding w3-center">
                <div class="w3-hide" id="del_news_id"></div>
                <a id="btn_accept_del_news" class="w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-trash"></i>&nbsp;Xóa</a>
                <a onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-times"></i>&nbsp;Hủy</a>
            </div>
        </div>
    </div>
    <script src="../Ajax/JS/Sortable.js"></script>
    <script src="../Scripts/javacuatui5.js"></script>
    <script src="../Ajax/JS/jquery-ui.js"></script>
</asp:Content>
